const { Client, Collection } = require('discord.js');
const { TOKEN } = require('./config.json');
const client = new Client({ intents: 131071 }); // our BOT
const { promisify } = require('util');
const { glob } = require('glob');
const Ascii = require('ascii-table');
const PG = promisify(glob);

client.commands = new Collection();

const { DisTube } = require('distube');
const { SpotifyPlugin } = require('@distube/spotify');

client.distube = new DisTube(client, {
  emitNewSongOnly: true,
  leaveOnFinish: true,
  emitAddSongWhenCreatingQueue: false,
  plugins: [new SpotifyPlugin()],
});
module.exports = client;

require('../Systems/giveawaySys.js')(client);
['events.js', 'commands.js'].forEach(handler => {
  require(`./Handlers/${handler}`)(client, PG, Ascii);
});

client.login(TOKEN);
